Video compression method and video compressor

ABSTRACT

A video compression method and a video compressor are provided to solve problems of huge resource consumption and high costs caused by performing both H.264 compression and HEVC compression. The method specifically includes: reading video signal data by using a sliding window to generate bitstream data, where bitstream data generated by reading the video signal data according to a first format is first bitstream data, and bitstream data generated by reading the video signal data according to a second format is second bitstream data; and coding the bitstream data to generate a bitstream, where a bitstream generated by coding the first bitstream data is a first bitstream, and a bitstream generated by coding the second bitstream data is a second bitstream, where the second format is a format preset according to the first format. The present invention is applied to video signal compression.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of International Application No.PCT/CN2014/071519, filed on Jan. 26, 2014, which claims priority toChinese Patent Application No. 201310385187.7, filed on Aug. 29, 2013,both of which are hereby incorporated by reference in their entireties.

TECHNICAL FIELD

The present invention relates to the field of image processing, and inparticular, to a video compression method and a video compressor.

BACKGROUND

A video signal includes a large amount of information, and is difficultfor storage and transmission, and therefore, video signals need to becompressed, so that the video signals are compressed. Redundancyinformation in a video signal includes time redundancy, spaceredundancy, compression redundancy, visual redundancy, and the like, andvideo compression aims to eliminate various types of redundancy to themaximum extent.

Currently, a major video signal compression standard is the H.264(MPEG-4 Part 10) standard. In recent years, based on the H.264 standard,a new-generation video compression standard HEVC also appears. HEVCstill follows a hybrid compression framework that is used by H.264 andincludes inter-frame and intra-frame prediction compression whicheliminates relevance between a time domain and a space domain; transformcompression which is performed on a residue to eliminate spacerelevance; and entropy compression which eliminates statisticalredundancy.

Currently, decoders of many terminal devices are H.264 decoders, andhigh efficiency video coding (HEVC) is a new standard and therefore, avideo compressor needs to support both the standards. In this way, H.264compressors will inevitably coexist with HEVC compressors within acertain time, and it is required that a compressor supports both theH.264 standard and the HEVC standard. In the prior art, a compressorimplements H.264 compression and HEVC compression by using two chipsrespectively, leading to huge resource consumption and high costs.

SUMMARY

Embodiments of the present invention provide a video compression methodand a video compressor, which implement H.264 compression and HEVCcompression on one chip, thereby reducing resource consumption and costsof video compression.

To achieve the foregoing objective, the embodiments of the presentinvention use the following technical solutions:

According to a first aspect, a video compression method is provided,including:

reading, by a video compressor, video signal data by using a slidingwindow to generate bitstream data, where the video compressor separatelyreads the video signal data in the sliding window according to a firstformat and a second format, where video signal data read according tothe first format is first data and generated bitstream data is firstbitstream data, and video signal data read according to the secondformat is second data and generated bitstream data is second bitstreamdata; and

coding, by the video compressor, the bitstream data to generate abitstream, where a bitstream generated by coding the first bitstreamdata is a first bitstream, and a bitstream generated by coding thesecond bitstream data is a second bitstream, where

the second format is a format preset according to the first format.

Optionally, with reference to the first aspect, in a first possibleimplementation manner, the reading, by a video compressor, video signaldata by using a sliding window to generate bitstream data specificallyincludes:

predicting, by the video compressor, original video data according tothe video signal data read by using the sliding window, so as togenerate residual data, where the prediction includes intra-frameprediction and inter-frame prediction;

acquiring, by the video compressor, bitstream control informationcorresponding to the residual data; and

combining, by the video compressor, the residual data and the bitstreamcontrol information to generate the bitstream data, where first residualdata is combined with the first bitstream control information togenerate the first bitstream data, and second residual data is combinedwith the second bitstream control information to generate the secondbitstream data, where

residual data generated by predicting, according to the first data, theoriginal video data is the first residual data and correspondingbitstream control information is the first bitstream controlinformation, and residual data generated by predicting, according to thesecond data, the original video data is the second residual data andcorresponding bitstream control information is the second bitstreamcontrol information; and

the residual data includes a difference between the original video dataand the video signal data read by using the sliding window, and thebitstream control information includes a description of positions of theoriginal video data and the video signal data read by using the slidingwindow and/or a description of a relationship between the original videodata and the video signal data read by using the sliding window, wherethe descriptions are obtained after the prediction.

Optionally, with reference to the first possible implementation manner,in a second possible implementation manner, the predicting, by the videocompressor, original video data according to the video signal data readby using the sliding window includes:

performing, by the video compressor, intra-frame prediction andinter-frame prediction on the original video data of a same data amountwithin a same time.

Optionally, with reference to the first or second possibleimplementation manner, in a third possible implementation manner, thereading, by a video compressor, video signal data by using a slidingwindow includes:

dividing, by the video compressor, the video signal data into blocks,where a data amount of a block read in the first format is the same asthat of a block read in the second format.

Optionally, with reference to the third possible implementation manner,in a fourth possible implementation manner, the predicting, by the videocompressor, original video data according to the video signal data readby using the sliding window specifically includes:

predicting, by the video compressor, an original video data block in apreset order according to the video signal data read by using thesliding window.

Optionally, with reference to the first aspect, or the first, second, orfourth possible implementation manner, in a fifth possibleimplementation manner, the coding, by the video compressor, thebitstream data to generate a bitstream further includes:

storing, by the video compressor, intermediate data needed for codingduring context modeling, where a storage format of intermediate dataneeded for coding the first bitstream data is the same as a storageformat of intermediate data needed for coding the second bitstream data.

According to a second aspect, a video compressor is provided, including:a reading unit and a coding unit, where

the reading unit is configured to read video signal data by using asliding window to generate bitstream data, where the reading unitseparately reads the video signal data in the sliding window accordingto a first format and a second format, where video signal data readaccording to the first format is first data and generated bitstream datais first bitstream data, and video signal data read according to thesecond format is second data and generated bitstream data is secondbitstream data; and

the coding unit is configured to code the bitstream data generated bythe reading unit to generate a bitstream, where a bitstream generated bycoding the first bitstream data is a first bitstream, and a bitstreamgenerated by coding the second bitstream data is a second bitstream,where

the second format is a format preset according to the first format.

Optionally, with reference to the second aspect, in a first possibleimplementation manner, the reading unit includes a prediction subunitand a combining subunit, where

the prediction subunit is configured to predict original video dataaccording to the video signal data read by using the sliding window, soas to generate residual data, where the prediction includes intra-frameprediction and inter-frame prediction;

the prediction subunit is further configured to acquire bitstreamcontrol information corresponding to the residual data; and

the combining subunit is configured to combine the residual datagenerated by the prediction subunit and the stream control informationgenerated by the prediction subunit to generate the bitstream data,where the first residual data is combined with the first bitstreamcontrol information to generate the first bitstream data, and the secondresidual data is combined with the second bitstream control informationto generate the second bitstream data, where

residual data generated by predicting, according to the first data, theoriginal video data is the first residual data and correspondingbitstream control information is the first bitstream controlinformation, and residual data generated by predicting, according to thesecond data, the original video data is the second residual data andcorresponding bitstream control information is the second bitstreamcontrol information; and

the residual data includes a difference between the original video dataand the video signal data read by using the sliding window, and thebitstream control information includes a description of positions of theoriginal video data and the video signal data read by using the slidingwindow and/or a description of a relationship between the original videodata and the video signal data read by using the sliding window, wherethe descriptions are obtained after the prediction.

Optionally, with reference to the first possible implementation manner,in a second possible implementation manner,

the prediction subunit performs intra-frame prediction and inter-frameprediction on the original video data of a same data amount within asame time.

Optionally, with reference to the first or second possibleimplementation manner, in a third possible implementation manner,

the reading unit is further configured to divide the video signal datainto blocks, where a data amount of a block read in the first format isthe same as that of a block read in the second format.

Optionally, with reference to the third possible implementation manner,in a fourth possible implementation manner, the prediction subunitpredicts an original video data block in a preset order according to thevideo signal data read by using the sliding window.

Optionally, with reference to the second aspect, or the first, second,or fourth possible implementation manner, in a fifth possibleimplementation manner, the video compressor further includes a storageunit, where

the storage unit is configured to store intermediate data needed forcoding by the coding unit during context modeling, where a storageformat of intermediate data needed for coding the first bitstream datais the same as a storage format of intermediate data needed for codingthe second bitstream data.

According to the video compression method and the video compressorprovided by the embodiments of the present invention, H.264 compressionand HEVC compression are implemented on one chip by properly adjustingreading and coding orders of H.264 and HEVC, so that resourceconsumption and costs of video compression are reduced.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the embodiments of the presentinvention more clearly, the following briefly introduces theaccompanying drawings required for describing the embodiments.Apparently, the accompanying drawings in the following description showmerely some embodiments of the present invention.

FIG. 1 is a schematic flowchart of a video compression method accordingto an embodiment of the present invention;

FIG. 2 is a schematic flowchart of a video compression method accordingto another embodiment of the present invention;

FIG. 3 is a schematic structural diagram of data read by a slidingwindow according to another embodiment of the present invention;

FIG. 4 is another schematic structural diagram of data read by a slidingwindow according to another embodiment of the present invention;

FIG. 5 is a schematic structural diagram of stored data according toanother embodiment of the present invention;

FIG. 6 is a schematic diagram of a method for reading a to-be-codedblock according to another embodiment of the present invention;

FIG. 7 is a schematic diagram of a bitstream prediction order accordingto another embodiment of the present invention;

FIG. 8 is schematic diagram of another bitstream prediction orderaccording to another embodiment of the present invention;

FIG. 9 is a schematic diagram of a method for combining bitstreamcontrol information and residual data according to another embodiment ofthe present invention;

FIG. 10 is a schematic structural diagram of a video compressoraccording to an embodiment of the present invention;

FIG. 11 is a schematic structural diagram of another video compressoraccording to an embodiment of the present invention; and

FIG. 12 is a schematic structural diagram of a video compressoraccording to another embodiment of the present invention.

DESCRIPTION OF EMBODIMENTS

The following clearly describes the technical solutions in theembodiments of the present invention with reference to the accompanyingdrawings in the embodiments of the present invention. Apparently, thedescribed embodiments are merely some but not all of the embodiments ofthe present invention.

In the prior art, operations such as reading, prediction, coding, andthe like need to be performed on video signal data to completeoperations on a video signal. Because orders of reading video signaldata in different video coding standards are different, storage andcoding manners in the different video coding standards are notcompatible, and video compression of the different video codingstandards cannot be implemented by using one chip.

An embodiment of the present invention provides a video compressionmethod, so as to implement H.264 compression and HEVC compression on onechip. Specifically, referring to FIG. 1, the method includes:

S11: A video compressor reads video signal data by using a slidingwindow to generate bitstream data.

The video compressor separately reads the video signal data in thesliding window according to a first format and a second format, wherevideo signal data read according to the first format is first data andgenerated bitstream data is first bitstream data, and video signal dataread according to the second format is second data and generatedbitstream data is second bitstream data.

S12: The video compressor codes the bitstream data to generate abitstream.

A bitstream generated by coding the first bitstream data is a firstbitstream, and a bitstream generated by coding the second bitstream datais a second bitstream, where

the second format is a format preset according to the first format.

Specifically, the first format is a format specified in the HEVCstandard, and the second format is a format that is adjusted accordingto the first format and is compliant with the H.264 standard. That is,format reading and coding orders specified in the H.264 standard areadjusted according to a format specified in the HEVC standard; in thisway, reading, storage, prediction, and coding of H.264 and HEVC can allbe implemented on one chip.

According to the video compression method provided by this embodiment ofthe present invention, H.264 compression and HEVC compression areimplemented on one chip by properly adjusting reading and coding ordersof H.264 and HEVC, and thereby resource consumption and costs of videocompression are reduced.

Optionally, an embodiment of the present invention further provides aspecific video compression method. Referring to FIG. 2, the methodincludes:

S21: A video compressor reads video signal data by using a slidingwindow to generate bitstream data.

The video compressor separately reads the video signal data in thesliding window according to a first format and a second format, wherevideo signal data read according to the first format is first data andgenerated bitstream data is first bitstream data, and video signal dataread according to the second format is second data and generatedbitstream data is second bitstream data. Specifically, the first formatis a format specified in the HEVC standard, and the second format is aformat that is adjusted according to the first format and is compliantwith the H.264 standard.

The video signal data read by using the sliding window includesreference data of original video data. Specifically, the videocompressor divides the video signal data in the sliding window intoblocks according to preset manners of the first format and the secondformat. Referring to FIG. 3, for the first format, a largest coding unit(Largest Coding Unit, LCU) in the HEVC standard is divided into blocksaccording to the second format, that is, the size of a macro block(Macro Block, MB) in the H.264 standard, where a block has a data amountthat is the same as a data amount of a macro block in the H.264standard, and is a square of 16×16 pixels; and H is the length of thesliding window and W is the width of the sliding window. For the secondformat, referring to FIG. 4, block division is performed according tothe size of a macro block in the H.264 standard, where a block has adata amount that is the same as the data amount of the macro block inthe H.264 standard, and is a square of 16×16 pixels, that is, a macroblock is a block; and H is the length of the sliding window and W is thewidth of the sliding window. For ease of distinguishing, a sub-block isused to specifically represent a block in the first format, and a macroblock is used to represent a block in the second format below.

When reading the video signal data by using the sliding window, thevideo compressor reads a neighboring data block of each original videodata block as reference data of this block, that is, the reference dataincludes data that provides reference for the video signal data to becompressed by the video compressor. Reading orders of video signal datain the existing HEVC standard and H.264 standard are different;therefore, reference data is also different.

In this case, reading orders in the HEVC standard and the H.264 standardare properly adjusted in order that storage and coding manners in theHEVC standard and the H.264 standard are compatible. For the firstformat, as shown in FIG. 3, a sub-block is read in an order that is thesame as an order of reading a largest coding unit in the HEVC standard,that is, reading is performed in an order of numerals in FIG. 3. For thesecond format, as shown in FIG. 4, a macro block is read in an order ofreading obliquely from an upper right corner to a lower left corner, andspecifically, reading is performed in an order of numerals in FIG. 4. Inthis way, same reference data is used for the first format and thesecond format.

In practice, because a reading speed and a coding speed are different,read data needs to be stored in a buffer. Because the reading order ischanged herein, the storage manner of the read data is also changed, anda storage manner is provided herein. Data read by the video compressorby using the sliding window is stored in a double data rate 3 (DoubleData Rate 3, DDR3) storage manner. Specifically, as shown in FIG. 5, forthe first format, that is, the storage format of data of the HEVCstandard in a DDR3, for each LCU of 64×64 pixels, luminance andchrominance of sub-blocks 0, 2, 8, and 10 of 4 consecutive neighboringLCUs are stored in neighboring DDR3 addresses in the DDR3 storagemanner. For the second format, that is, the storage format of data ofthe H.264 standard in a DDR3, for an MB, luminance and chrominance ofmacro blocks 0, 2, 5, and 9 of 4 consecutive neighboring MB rows arestored in neighboring DDR3 addresses in the DDR3 storage manner.

In this way, data of 16×256 can be read continuously in the DDR3 eachtime, which increases the reading speed, and ensures that storagemanners of HEVC and H.264 are the same.

S22: The video compressor predicts original video data according to thevideo signal data read by using the sliding window, so as to generateresidual data and bitstream control information corresponding to theresidual data.

In practice, a video signal (that is, reference data) read by thesliding window is stored in a DDR3; therefore, the reference data storedin the DDR3 needs to be read to predict the original video data.Specifically, referring to FIG. 6, bitstream data stored in the DDR3 andobtained after combining is read in the reading order in step 21 in theunit of blocks.

The video compressor separately performs intra-frame prediction andinter-frame prediction on the original video data according to the videosignal (that is, reference data) data read by the sliding window, so asto generate the residual data, that is, the residual data includes adifference between the original video data and the video signal (thatis, reference data) read by the sliding window. At the same time, thevideo compressor acquires the bitstream control informationcorresponding to the residual data, where the bitstream controlinformation includes a description of positions of the original videodata and the video signal data read by using the sliding window and/or adescription of a relationship between the original video data and thevideo signal data read by using the sliding window, where thedescriptions are obtained after the prediction. Residual data generatedby predicting, according to the first data, the original video data isfirst residual data and corresponding bitstream control information isfirst bitstream control information, and residual data generated bypredicting, according to the second data, the original video data issecond residual data and corresponding bitstream control information issecond bitstream control information.

Specifically, referring to FIG. 7, when predicting an original videodata block in a preset order, the video compressor uses a bottom-upintra-frame and inter-frame prediction method, that is, a small CU isfirst calculated, a large CU is then calculated, and the original videodata of a same data amount is predicted within a same time.Specifically, referring to FIG. 8, for the first format, that is, theHEVC standard, 4 data blocks of 8×8 pixels, namely, a sub-block of 16×16pixels, are predicted. Within a same time, for the second format, thatis, the H.264 standard, 1 macro block is predicted each time. When 4sub-blocks of 16×16 pixels are predicted in the first format, 4 macroblocks are predicted in the second format. When 4 data blocks of 32×32pixels are predicted in the first format, 16 macro blocks are predictedin the second format.

S23: The video compressor combines the residual data and the bitstreamcontrol information corresponding to the residual data to generate thebitstream data.

The first residual data is combined with the first bitstream controlinformation to generate the first bitstream data, and the secondresidual data is combined with the second bitstream control informationto generate the second bitstream data.

In practice, both the residual data generated after the prediction andthe bitstream control information corresponding to the residual dataneed to be stored in the DDR3 storage manner; in this case, the residualdata and the bitstream control information corresponding to the residualdata that are stored in the DDR3 storage manner are combined.

Referring to FIG. 9, for the first format, that is, the HEVC standard,control information and residual data of one LCU row are stored in theDDR3; in this case, all sub-blocks covered by an LCU are stored inneighboring addresses. Data of LCU rows is continuously stored in theDDR3, and residual data in a same LCU is stored in neighboringaddresses. For the H.264 standard, residual data of a macro blockcovered by one data block of the size of an LCU of the HEVC standard isstored in neighboring addresses.

An LCU of the HEVC standard and a macro block, covered by a data blockof the size of the LCU of the HEVC standard, of the H.264 standard arestored in a same address segment, and occupy same space obtained bydividing the DDR3; in this way, the combined bitstream data has a samestorage format in the storage space.

S24: The video compressor codes the bitstream data to generate abitstream, where the first bitstream data is coded to generate a firstbitstream, and the second bitstream data is coded to generate a secondbitstream.

The first format and the second format, that is, context-based adaptivebinary arithmetic coding (Context-based Adaptive Binary ArithmeticCoding, CABAC) modules in the HEVC standard and the H.264 standard, aresimilar from the perspective of protocols of the HEVC standard and H.264standard during syntax element binarization and context modeling;therefore, after the reading order is adjusted, a storage format ofintermediate data needed for coding the first bitstream data is the sameas a storage format of intermediate data needed for coding the secondbitstream data.

In this way, storage formats and coding orders of the first format andthe second format, that is, storage formats and coding orders of theHEVC standard and the H.264 standard, are made to be the same bychanging a reading method and a reading order, and the effect of beingcompatible is achieved.

According to the video compression method provided by this embodiment ofthe present invention, H.264 compression and HEVC compression areimplemented on one chip by properly adjusting reading and coding ordersof H.264 and HEVC, so that resource consumption and costs of videocompression are reduced.

An embodiment of the present invention provides a video compressor,configured to implement the video compression methods provided by theforegoing method embodiments. Specifically, referring to FIG. 10, avideo compressor 10 includes: a reading unit 101 and a coding unit 102.

The reading unit 101 is configured to read video signal data by using asliding window to generate bitstream data, where the reading unit 101separately reads the video signal data in the sliding window accordingto a first format and a second format, where video signal data readaccording to the first format is first data and generated bitstream datais first bitstream data, and video signal data read according to thesecond format is second data and generated bitstream data is secondbitstream data.

The coding unit 102 is configured to code the bitstream data generatedby the reading unit 101 to generate a bitstream, where a bitstreamgenerated by coding the first bitstream data is a first bitstream, and abitstream generated by coding the second bitstream data is a secondbitstream, where

the second format is a format preset according to the first format.

According to the video compressor provided by this embodiment of thepresent invention, H.264 compression and HEVC compression areimplemented on one chip by properly adjusting reading and coding ordersof H.264 and HEVC, so that resource consumption and costs of videocompression are reduced.

Optionally, referring to FIG. 11, the reading unit 101 of the videocompressor 10 provided by this embodiment of the present inventionincludes a prediction subunit 1011 and a combining subunit 1012.

The prediction subunit 1011 is configured to predict original video dataaccording to the video signal data read by using the sliding window, soas to generate residual data, where the prediction includes intra-frameprediction and inter-frame prediction.

The prediction subunit 1011 performs intra-frame prediction andinter-frame prediction on the original video data of a same data amountwithin a same time.

The prediction subunit 1011 is further configured to acquire bitstreamcontrol information corresponding to the residual data.

The combining subunit 1012 is configured to combine the residual datagenerated by the prediction subunit 1011 and the stream controlinformation generated by the prediction subunit 1011 to generate thebitstream data, where first residual data is combined with firstbitstream control information to generate the first bitstream data, andsecond residual data is combined with second bitstream controlinformation to generate the second bitstream data.

Residual data generated by predicting, according to the first data, theoriginal video data is the first residual data and correspondingbitstream control information is the first bitstream controlinformation, and residual data generated by predicting, according to thesecond data, the original video data is the second residual data andcorresponding bitstream control information is the second bitstreamcontrol information.

The residual data includes a difference between the original video dataand the video signal data read by using the sliding window, and thebitstream control information includes a description of positions of theoriginal video data and the video signal data read by using the slidingwindow and/or a description of a relationship between the original videodata and the video signal data read by using the sliding window, wherethe descriptions are obtained after the prediction.

Optionally, the reading unit 101 is further configured to divide thevideo signal data into blocks, where a data amount of a block read inthe first format is the same as that of a block read in the secondformat.

The prediction subunit 1011 predicts an original video data block in apreset order according to the video signal data read by using thesliding window.

Further optionally, the video compressor 10 further includes a storageunit 103.

The storage unit 103 is configured to store intermediate data needed forcoding by the coding unit 102 during context modeling, where a storageformat of intermediate data needed for coding the first bitstream datais the same as a storage format of intermediate data needed for codingthe second bitstream data.

According to the video compressor provided by this embodiment of thepresent invention, H.264 compression and HEVC compression areimplemented on one chip by properly adjusting reading and coding ordersof H.264 and HEVC, so that resource consumption and costs of videocompression are reduced.

An embodiment of the present invention further provides a videocompressor 12. Referring to FIG. 12, the video compressor 12 includes:at least one processor 121, a data bus 122, a memory 123, and acommunications interface 124, where the at least one processor 121, thememory 123, and the communications interface 124 are connected andcomplete mutual communication by using the data bus 122.

The data bus 122 may be an industry standard architecture (IndustryStandard Architecture, ISA) bus, a peripheral component interconnect(Peripheral Component, PCI) bus, an extended industry standardarchitecture (Extended Industry Standard Architecture, EISA) bus, or thelike. The data bus 122 may be classified into an address bus, a databus, a control bus, and the like. For ease of description, in FIG. 12,the data bus 122 is represented by using only one bold line, which doesnot mean that there is only one bus or one type of bus.

The memory 123 is configured to store executable program code andcorresponding data, where the program code includes a computer operationinstruction. The memory 123 may include a high-speed RAM memory, and mayalso include a non-volatile memory. In the present invention, the memoryis at least configured to store reference data, residual data, andbitstream control information.

The processor 121 may be a central processing unit CPU, an applicationspecific integrated circuit ASIC, or one or more integrated circuitsconfigured to implement the embodiments of the present invention.

The communications interface 124 is configured to implement dataexchange between the video compressor 12 and the outside.

The processor 121 is further configured to call the program code in thememory 123 to perform the operations of the reading unit 101 and thecoding unit 102 in the foregoing apparatus embodiment. For a specificdescription, refer to the apparatus embodiments correspond to FIG. 10and FIG. 11, and details are not provided herein again.

Through the descriptions of the foregoing embodiments, a person skilledin the art may clearly understand that the present invention may beimplemented by hardware, firmware or a combination thereof. When thepresent invention is implemented by software, the foregoing functionsmay be stored in a computer-readable medium or transmitted as one ormore instructions or code in the computer-readable medium. Thecomputer-readable medium includes a computer storage medium and acommunications medium, where the communications medium includes anymedium that facilitates transmission of a computer program from oneplace to another. The storage medium may be any available mediumaccessible to a computer. The following provides an example but does notimpose a limitation: The computer-readable medium may include a RAM, aROM, an EEPROM, a CD-ROM, or another optical disc storage or diskstorage medium, or another magnetic storage device, or any other mediumthat can carry or store expected program code in a form of instructionsor a data structure and can be accessed by a computer. In addition, anyconnection may be appropriately defined as a computer-readable medium.For example, if software is transmitted from a website, a server oranother remote source by using a coaxial cable, an optical fiber/cable,a twisted pair, a digital subscriber line (DSL) or wireless technologiessuch as infrared ray, radio and microwave, the coaxial cable, opticalfiber/cable, twisted pair, DSL or wireless technologies such as infraredray, radio and microwave are included in the definition of medium. Forexample, a disk (Disk) and disc (disc) used in the present inventionincludes a compact disc CD, a laser disc, an optical disc, a digitalversatile disc (DVD), a floppy disk and a Blu-ray disc, where the diskgenerally copies data magnetically, and the disc copies data opticallyby using lasers. The foregoing combination should also fall within theprotection scope of the computer-readable medium.

The foregoing descriptions are merely specific implementation manners ofthe present invention, but are not intended to limit the protectionscope of the present invention. Any variation or replacement readilyfigured out by a person skilled in the art within the technical scopedisclosed in the present invention shall fall within the protectionscope of the present invention. Therefore, the protection scope of thepresent invention shall be subject to the protection scope of theclaims.

What is claimed is:
 1. A video compression method, comprising: reading,by a video compressor, video signal data by using a sliding window togenerate bitstream data, wherein the video compressor separately readsthe video signal data in the sliding window according to a first formatand a second format, wherein video signal data read according to thefirst format is first data and generated bitstream data is firstbitstream data, and video signal data read according to the secondformat is second data and generated bitstream data is second bitstreamdata; and coding, by the video compressor, the bitstream data togenerate a bitstream, wherein a bitstream generated by coding the firstbitstream data is a first bitstream, and a bitstream generated by codingthe second bitstream data is a second bitstream, wherein the secondformat is a format preset according to the first format.
 2. The videocompression method according to claim 1, wherein reading, by a videocompressor, video signal data by using a sliding window to generatebitstream data comprises: predicting, by the video compressor, originalvideo data according to the video signal data read by using the slidingwindow, so as to generate residual data, wherein the predictingcomprises intra-frame predicting and inter-frame predicting; acquiring,by the video compressor, bitstream control information corresponding tothe residual data; and combining, by the video compressor, the residualdata and the bitstream control information to generate the bitstreamdata, wherein first residual data is combined with the first bitstreamcontrol information to generate the first bitstream data, and secondresidual data is combined with the second bitstream control informationto generate the second bitstream data, wherein residual data generatedby predicting, according to the first data, the original video data isthe first residual data and corresponding bitstream control informationis the first bitstream control information, and residual data generatedby predicting, according to the second data, the original video data isthe second residual data and corresponding bitstream control informationis the second bitstream control information, and the residual datacomprises a difference between the original video data and the videosignal data read by using the sliding window, and the bitstream controlinformation comprises a description of positions of the original videodata and the video signal data read by using the sliding window and/or adescription of a relationship between the original video data and thevideo signal data read by using the sliding window, wherein thedescriptions are obtained after the prediction.
 3. The video compressionmethod according to claim 2, wherein predicting, by the videocompressor, original video data according to the video signal data readby using the sliding window comprises: performing, by the videocompressor, intra-frame prediction and inter-frame prediction on theoriginal video data of a same data amount within a same time.
 4. Thevideo compression method according to claim 2, wherein reading, by avideo compressor, video signal data by using a sliding window comprises:dividing, by the video compressor, the video signal data into blocks,wherein a data amount of a block read in the first format is the same asthat of a block read in the second format.
 5. The video compressionmethod according to claim 4, wherein predicting, by the videocompressor, original video data according to the video signal data readby using the sliding window comprises: predicting, by the videocompressor, an original video data block in preset order according tothe video signal data read by using the sliding window.
 6. The videocompression method according to claim 1, wherein coding, by the videocompressor, the bitstream data to generate a bitstream furthercomprises: storing, by the video compressor, intermediate data neededfor coding during context modeling, wherein a storage format ofintermediate data needed for coding the first bitstream data is the sameas a storage format of intermediate data needed for coding the secondbitstream data.
 7. A video compressor, comprising: a reading unitconfigured to read video signal data by using a sliding window togenerate bitstream data, wherein the reading unit separately reads thevideo signal data in the sliding window according to a first format anda second format, wherein video signal data read according to the firstformat is first data and generated bitstream data is first bitstreamdata, and video signal data read according to the second format issecond data and generated bitstream data is second bitstream data; and acoding unit configured to code the bitstream data generated by thereading unit to generate a bitstream, wherein a bitstream generated bycoding the first bitstream data is a first bitstream, and a bitstreamgenerated by coding the second bitstream data is a second bitstream,wherein the second format is a format preset according to the firstformat.
 8. The video compressor according to claim 7, wherein thereading unit comprises: a prediction subunit configured to: predictoriginal video data according to the video signal data read by using thesliding window, so as to generate residual data, wherein the predictioncomprises intra-frame prediction and inter-frame prediction, and acquirebitstream control information corresponding to the residual data; and acombining subunit configured to combine the residual data generated bythe prediction subunit and the bitstream control information generatedby the prediction subunit to generate the bitstream data, wherein thefirst residual data is combined with the first bitstream controlinformation to generate the first bitstream data, and the secondresidual data is combined with the second bitstream control informationto generate the second bitstream data, wherein residual data generatedby predicting, according to the first data, the original video data isthe first residual data and corresponding bitstream control informationis the first bitstream control information, and residual data generatedby predicting, according to the second data, the original video data isthe second residual data and corresponding bitstream control informationis the second bitstream control information, and the residual datacomprises a difference between the original video data and the videosignal data read by using the sliding window, and the bitstream controlinformation comprises a description of positions of the original videodata and the video signal data read by using the sliding window and/or adescription of a relationship between the original video data and thevideo signal data read by using the sliding window, wherein thedescriptions are obtained after the prediction.
 9. The video compressoraccording to claim 8, wherein the prediction subunit performsintra-frame prediction and inter-frame prediction on the original videodata of a same data amount within a same time.
 10. The video compressoraccording to claim 8, wherein the reading unit is further configured todivide the video signal data into blocks, wherein a data amount of ablock read in the first format is the same as that of a block read inthe second format.
 11. The video compressor according to claim 10,wherein the prediction subunit predicts an original video data block ina preset order according to the video signal data read by using thesliding window.
 12. The video compressor according to claim 7, whereinthe video compressor further comprises: a storage unit configured tostore intermediate data needed for coding by the coding unit duringcontext modeling, wherein a storage format of intermediate data neededfor coding the first bitstream data is the same as a storage format ofintermediate data needed for coding the second bitstream data.